package com.abe.bathsystem.contract;

import com.abe.bathsystem.entity.ReqBaseEntity;
import com.abe.bathsystem.entity.ReqBaseNoDataEntity;
import com.abe.bathsystem.entity.ReqConstant;
import com.abe.bathsystem.entity.http.HttpAdEntity;
import com.abe.bathsystem.entity.http.HttpBathPosStateEntity;
import com.abe.bathsystem.entity.http.HttpNoticeEntity;
import com.abe.bathsystem.entity.http.HttpRoomEntity;
import com.abe.bathsystem.entity.http.HttpSensorEntity;
import com.abe.bathsystem.entity.http.HttpUserEntity;
import com.abe.bathsystem.entity.http.HttpVersionEntity;
import com.abe.mvpcore.BaseView;
import com.abe.mvpcore.OnResultListener;

import java.util.List;

public class CommonContract {
    public interface UploadView extends BaseView {
        void onUploadLog(boolean isSuccess, int resId, String message);

        void onSaveLog(boolean isSuccess, String message);

        UploadPresenter uploadPresenter();
    }

    public interface UploadPresenter {
        void uploadLog(String fileName);

        void saveLogData(String resId);
    }

    public interface VersionView extends BaseView {
        void onCheckVersion(boolean isSuccess, boolean isAutoUpdate, HttpVersionEntity versionEntity);

        VersionPresenter versionPresenter();
    }

    //版本更新
    public interface VersionPresenter {
        void checkVersion(boolean isAutoUpdate);
    }

    public interface ServerView extends BaseView {

        void onServerData(HttpRoomEntity entity);

        void onRoomUnregistered();

        void onUploadClientId(boolean isUploadSuccess);

        ServerPresenter serverPresenter();
    }

    //服务信息
    public interface ServerPresenter {

        void getServerData();

        void uploadClientId(String id);
    }

    //广告相关
    public interface AdView extends BaseView {

        void onAdData(List<HttpAdEntity> entity);

        void onNoticeData(List<HttpNoticeEntity> entities);

        AdPresenter adPresenter();
    }

    //广告相关
    public interface AdPresenter {

        void getAdData();

        void getNotice();
    }

    //登录
    public interface LoginView extends BaseView {
        void onLogin(boolean isSuccess, HttpUserEntity entity);

        LoginPresenter loginPresenter();
    }

    //登录
    public interface LoginPresenter {
        void login(String phone, String password);
    }

    //订单操作相关
    public interface OrderView extends BaseView {
        void onOrderStart(HttpUserEntity userEntity, HttpBathPosStateEntity posStateEntity, boolean isSuccess, String message, boolean isDeviceSend);

        void onOrderEnd(HttpUserEntity userEntity, HttpBathPosStateEntity posStateEntity, boolean isSuccess, boolean isDeviceSend);

        OrderPresenter orderPresenter();
    }

    public interface OrderPresenter {
        void orderStart(HttpUserEntity userEntity, HttpBathPosStateEntity posStateEntity, boolean isDeviceSend);

        void orderEnd(boolean isDeviceSend, HttpUserEntity userEntity, HttpBathPosStateEntity posStateEntity, float xi_yu_da, float xi_yu_xiao,
                      float fee_total, float fee_xi_yu_da, float fee_xi_yu_xiao, float fee_chui_feng,
                      float fee_chong_dian);
    }

    //洗浴位状态
    public interface BathPosView extends BaseView {
        void onUpdateSensor(boolean isSuccess);

        void onUpdateBathPos(int position, @ReqConstant.BATH_POS_STATE int state, boolean isUpdateSuccess);

        void onGetBathPosState(List<HttpBathPosStateEntity> entities, boolean isChoosePos);

        BathPosPresenter bathPosPresenter();
    }

    public interface BathPosPresenter {
        void updateSensor(List<HttpSensorEntity> sensorEntities);

        void updateBathPosState(int position, @ReqConstant.BATH_POS_STATE int status, int sensor01, int sensor02);

        void getRoomStatus(boolean isChoosePos);
    }


    interface Model {

        void uploadLog(String fileName, OnResultListener<ReqBaseEntity<Integer>> listener);

        void saveLogData(String resId, OnResultListener<ReqBaseNoDataEntity> listener);

        void checkVersion(OnResultListener<ReqBaseEntity<HttpVersionEntity>> listener);

        void getRoomData(OnResultListener<ReqBaseEntity<HttpRoomEntity>> listener);

        void getAdData(OnResultListener<ReqBaseEntity<List<HttpAdEntity>>> listener);

        void getRoomStatus(OnResultListener<ReqBaseEntity<List<HttpBathPosStateEntity>>> listener);

        void login(String phone, String password, OnResultListener<ReqBaseEntity<HttpUserEntity>> listener);

        void updateBathPosState(int position, @ReqConstant.BATH_POS_STATE int status, int sensor01, int sensor02, OnResultListener<ReqBaseNoDataEntity> listener);

        void uploadClientId(String id, OnResultListener<ReqBaseNoDataEntity> listener);

        void orderStart(HttpUserEntity userEntity, HttpBathPosStateEntity posStateEntity, OnResultListener<ReqBaseNoDataEntity> listener);

        void orderEnd(HttpUserEntity userEntity, HttpBathPosStateEntity posStateEntity, float xi_yu_da, float xi_yu_xiao,
                      float fee_total, float fee_xi_yu_da, float fee_xi_yu_xiao, float fee_chui_feng,
                      float fee_chong_dian, OnResultListener<ReqBaseNoDataEntity> listener);

        void getNotice(OnResultListener<ReqBaseEntity<List<HttpNoticeEntity>>> listener);

        void uploadSensorData(List<HttpSensorEntity> sensorEntities, OnResultListener<ReqBaseNoDataEntity> listener);
    }
}